package app.auto.runner;

import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.RadioButton;
import android.widget.TextView;

import com.zhy.autolayout.AutoLayoutActivity;

import app.auto.runner.base.ActivityStack;
import app.auto.runner.base.action.ViewInflater;
import app.auto.runner.base.utility.OrientUtil;
import app.auto.runner.base.utility.ToastUtil;

/**
 * Created by Administrator on 2017/11/3.
 */
public class ActivityBase extends AutoLayoutActivity {
    ToastUtil toastUtil = new ToastUtil(this);

    public void showToast(String string) {
        toastUtil.toast(string, "");
    }

    public String getTextString(int id) {
        return ((TextView) findViewById(id)).getText().toString();
    }

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        OrientUtil.orient(this);
       ActivityStack.getInstance().addActivity(this);
    }


    @Override
    public void setContentView(int layoutResID) {
        super.setContentView(new ViewInflater(this).inflate(layoutResID, null));
    }

    public TextView getTextView(int id) {
        return (TextView) findViewById(id);
    }

    public EditText getEditText(int id) {
        return (EditText) findViewById(id);
    }

    public RadioButton getRadioButton(int id) {
        return (RadioButton) findViewById(id);
    }

    public ImageView getImageView(int id) {
        return (ImageView) findViewById(id);
    }

    public View getView(int id) {
        return findViewById(id);
    }


}
